<link href="/assets/home/css/center.css" rel="stylesheet" />

<body>
	<!-- 头部 -->
	<div class="user">
		<div class="avatar wow fadeInUp">
            {if isset($business)}
                {if empty($business['avatar'])}
                    <img src="/assets/img/avatar.png" />
                {else}
                    <img src="{$business['avatar']}" />
                {/if}
            {else}
                <img src="/assets/img/avatar.png" />
            {/if}
		</div>

		<div class="nickname wow fadeInUp" data-wow-delay="100ms">
			{if isset($business)}
                {if empty($business['nickname'])}
                    未设置昵称
                {else}
                    {$business['nickname']}
                {/if}
            {else}
                未登录
            {/if}
		</div>

		{if !isset($business)}
		<a href="{:url('home/index/login')}" class="login wow fadeInUp" data-wow-delay="200ms">登录</a>
		{/if}
	</div>

	<!-- 菜单 -->
	<div class="menulist wow fadeInUp" data-wow-delay="300ms">
		<a href="{:url('home/business/profile')}" class="item">
			<span>基本资料</span>
			<img src="/assets/home/images/row.png" />
		</a>
		{if condition="!isset($business) || $business['auth'] == 0"}
			<a href="{:url('home/business/email')}" class="item">
				<span>邮箱认证</span>
				<img src="/assets/home/images/row.png" />
			</a>
		{/if}
		
		{if condition="isset($isWechatLogin) && $isWechatLogin"}
			<a href="{:url('home/wechat/oauth')}" class="item">
				<span>使用微信账号直接登录</span>
				<img src="/assets/home/images/row.png" />
			</a>
		{/if}
		
		<a href="{:url('home/business/order')}" class="item">
			<span>我的订单</span>
			<img src="/assets/home/images/row.png" />
		</a>
		<a href="{:url('home/business/record')}" class="item">
			<span>我的消费</span>
			<img src="/assets/home/images/row.png" />
		</a>
		<a href="{:url('home/business/pay')}" class="item">
			<span>充值</span>
			<img src="/assets/home/images/row.png" />
		</a> 
		<a href="contact.html" class="item">
			<span>联系我们</span>
			<img src="/assets/home/images/row.png" />
		</a>
		<a id="logout" href="javascript:void(0)" class="item">
			<span>退出</span>
			<img src="/assets/home/images/row.png" />
		</a>
	</div>

	<!-- 底部 -->
	{include file="common/menu" /}
</body>

<script>
	$('#logout').click(() => {
		mui.confirm('是否确认退出', '退出提醒', ['确认', '取消'], function (res) {
			if (res.index === 0) {
				mui.toast('退出成功');

				// 关闭当前窗口
				$('.mui-popup-backdrop').remove();
				$('.mui-popup').remove();

				setTimeout(() => {
					location.href = '{:url("home/index/logout")}';
				}, 500);
			}
		});
	});
</script>
